import Vue from 'vue';
import Vuex from 'vuex';
import {
	getDepartTree
} from '@/api/system/tbSysDept';
Vue.use(Vuex)
const state = {
	departTree: []
}
const actions = {
	//获取部门列表数据
	async getDepartList({
		commit
	}) {
		let result = await getDepartTree({
			del: '1'
		}).then(res => res.data)
		if (result.code == '0') {
			commit('SET_DEPART_TREE', result.data || []);
		} else {
			Promise.reject(new Error('faile'));
		}
	}
}
const mutations = {
	SET_DEPART_TREE: (state, d) => {
		state.departTree = d;
	}
}
export default {
	state,
	actions,
	mutations
}